package com.swak.frame.exception;

import com.swak.frame.enums.BasicErrCode;
import com.swak.frame.enums.IResultCode;
import com.swak.frame.exception.core.BaseException;

/**
 * System Exception is unexpected Exception, retry might work again
 * 
 * @author colley.ma
 * @since 2022/07/14
 */
public class SysException extends BaseException {

    private static final long serialVersionUID = 4355163994767354840L;

    public SysException(String errMessage){
        super(errMessage);
        this.setErrCode(BasicErrCode.SYS_ERROR);
    }

    public SysException(IResultCode errCode, String errMessage) {
        super(errMessage);
        this.setErrCode(errCode);
    }

    public SysException(String errMessage, Throwable e) {
        super(errMessage, e);
        this.setErrCode(BasicErrCode.SYS_ERROR);
    }
    
    public SysException(Throwable e) {
        super("Internal server error", e);
        this.setErrCode(BasicErrCode.SYS_ERROR);
    }


    public SysException(String errMessage, IResultCode errorCode, Throwable e) {
        super(errMessage, e);
        this.setErrCode(errorCode);
    }
}
